$title TwoByTwo model

* -----------------------------------------------------------------------------------
* Closed economy with two goods and two factors.
* Laurent Cretegny, CoPS, Monash University, Australia, 2004.
* -----------------------------------------------------------------------------------

scalar    endow     index of labour endowment     / 1.0 /;

$ontext
$model:twobytwo

$sectors:
  x                 ! production for sector X
  y                 ! production for sector Y
  c                 ! consumption index

$commodities:
  px                ! price index for commodity X
  py                ! price index for commodity Y
  pc                ! consumer price index
  pl                ! price index for primary factor L
  pk                ! price index for primary factor K

$consumers:
  ra                ! income for representative agent RA

$prod:x             s:1
  o:px              q:100
  i:pl              q:50
  i:pk              q:50

$prod:y             s:1
  o:py              q:50
  i:pl              q:20
  i:pk              q:30

$prod:c             s:1
  o:pc              q:150
  i:px              q:100
  i:py              q:50

$demand:ra
  d:pc
  e:pl              q:(70*endow)
  e:pk              q:80

$report:
  v:cx              i:px                prod:c
  v:cy              i:py                prod:c

$offtext
$sysinclude mpsgeset twobytwo

* Benchmark replication

twobytwo.iterlim = 0;
$include twobytwo.gen
solve twobytwo using mcp;
abort$(abs(twobytwo.objval) gt 1e-7) "*** twobytwo does not calibrate ! ***";
twobytwo.iterlim = 1000;

* Fixation of a numeraire to allow comparison

px.fx = px.l;

* Counterfactual : 10% increase in labor endowment

endow = 1.1;

$include twobytwo.gen
solve twobytwo using mcp;

* Results

parameters
  res_com           results by commodity in % change from basis
  res_agg           aggregate results in % change from basis; 

res_com("output","x") = (x.l - 1) * 100;
res_com("output","y") = (y.l - 1) * 100;
res_com("cons","x") = (cx.l/100 - 1) * 100;
res_com("cons","y") = (cy.l/50 - 1) * 100;
res_com("price","x") = (px.l - 1) * 100;
res_com("price","y") = (py.l - 1) * 100;

res_agg("agg cons") = (c.l - 1) * 100;
res_agg("cpi") = (pc.l - 1) * 100;
res_agg("income") = (ra.l/150 - 1) * 100;

option decimals = 6;
display res_com, res_agg;
